//
//  CalculatorView.h
//  MoneyIndividual
//
//  Created by Tai Le on 12/30/13.
//  Copyright (c) 2013 Le Anh Tai. All rights reserved.
//

#import "BaseView.h"

typedef enum
{
    ComputeNone = 0,
    ComputeC,
    ComputeAdd,
    ComputeSubtract,
    ComputeMulti,
    ComputeDivide,
    ComputeEqual
}Compute;

typedef enum
{
    TextFieldStateWaitingNewInput,
    TextFieldStateInputing
}TextFieldState;

@protocol CalculatorViewDelegate;
@interface CalculatorView : UIToolbar
{
    NSMutableArray *_buttons;
    NSMutableArray *_lines;
    float _result;
}

@property (nonatomic, weak) id<CalculatorViewDelegate> calculatorDelegate;
@property (nonatomic, assign) Compute compute;
@property (nonatomic, assign) TextFieldState state;
@property (nonatomic, weak) UITextField *textField;

- (id)initWithTextField:(UITextField*)textField;
- (void)startupWithResult:(float)result;

@end

@protocol CalculatorViewDelegate <NSObject>

- (void)calculator:(CalculatorView*)view didPressedComput:(Compute)compute;


@end
